package drive.Mapper;

import drive.Model.Useraddr;
import org.apache.ibatis.annotations.*;

import java.util.List;
//完成基础测试，2025.3.17
@Mapper
public interface UseraddrMapper {
    @Insert("INSERT INTO useraddr(userID, address, phone, status) VALUES(#{userID}, #{address}, #{phone}, #{status})")
    int addUserAddr(Useraddr userAddr);

    @Select("SELECT * FROM useraddr WHERE userID = #{userID}")
    List<Useraddr> getUserAddr(int userID);

    @Update("UPDATE useraddr SET userID = #{userID}, address = #{address}, phone = #{phone}, status = #{status} WHERE addrID = #{addrID}")
    int updateUserAddr(Useraddr userAddr);

    @Delete("DELETE FROM useraddr WHERE addrID = #{addrID}")
    int deleteUserAddr(int addrID);
}